/**
*      author: Y_Yao
*      created: 2025-02-24 22:21:55
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int n,q;
int a[N];
int del[N],v[N];

void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }
    cin >> q;
    int ver = 0,cur = 0;
    while(q--)
    {
        int op;
        cin >> op;
        if(op == 1)
        {
            int k;
            cin >> k;
            ver++;
            cur = k;
        }
        else if(op == 2)
        {
            int i,k;
            cin >> i >> k;
            if(v[i] < ver)
            {
                v[i] = ver;
                del[i] = k;
            }
            else if(v[i] == ver)
            {
                del[i] += k;
            }
        }
        else
        {
            int i;
            cin >> i;
            if(cur == 0)
            {
                cout << a[i] + del[i] << endl;
            }
            else if(v[i] < ver)
            {
                cout << cur << endl;
            }
            else
            {
                cout << cur + del[i] << endl;
            }
        }
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
